home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / C++ / Applications / PICSee Dust 1.01 / Quaternary Source / SoundUtils.h < prev    next >
Text File  |  1995-11-02  |  2KB  |  68 lines

  1. #ifndef SOUNDUTILS_H_
  2. #define SOUNDUTILS_H_
  3.  
  4. #include <Sound.h>
  5.  
  6. #ifdef __cplusplus
  7. extern "C" {
  8. #endif
  9.  
  10. // ---------------------------------------------------------------------------
  11.  
  12. // Define some additional rates (which aren't defined in older Sound.h files)
  13. #define rate7khz         (long)0x1CFA2E8B    // 7418.1818 in fixed-point
  14. #define rate5khz         (long)0x15BBA28E    // 5563.6363 in fixed-point
  15. #define rate22050hz        (long)0x56220000    // 22050.0000 in fixed-point
  16. #define rate11050hz        (long)0x2B110000    // 11025.0000 in fixed-point
  17.  
  18. // Maximum number of channels SoundUtils.c can handle
  19. enum {
  20.     kMaxChans = 4
  21. };
  22.  
  23. // ---------------------------------------------------------------------------
  24.  
  25. // Make sure you call this before making any other calls in SoundUtils.c
  26. void InitSoundUtils();
  27.  
  28. // Create/dispose a sound channel. It is up to you to keep
  29. // track of which ones you created.
  30. // Specify 0..kMaxChans-1 in whichChan
  31. OSErr CreateSndChannel(short whichChan);
  32. OSErr DisposeSndChannel(short whichChan);
  33.  
  34. void PlayAsynch(Handle sndHdl, short whichChan);
  35. void PlayAsynchBuffer(Handle sndHdl, short whichChan);
  36. Boolean SndDone(short whichChan);
  37. void WaitTillSndDone(short whichChan);
  38. void SndStop(short whichChan);
  39. void SndStopSoftly(short whichChan);
  40. short SndGetAmplitude(short whichChan);
  41. void SndSetAmplitude(short whichChan, short amp);
  42.  
  43. OSErr RetrieveSndHeaderOffset(Handle sndHdl, long *offset);
  44. SoundHeader *GetSoundHeader(Handle sndHdl);
  45.  
  46. // These use a callback mechanism...
  47. OSErr PlayAsynchCallback(Handle sndHdl, short whichChan);
  48. OSErr PlayAsynchCallbackPriority(Handle sndHdl, short whichChan, short priority);
  49.  
  50. typedef pascal void (*SndCleanupProc)(Handle snd);
  51. void DefaultSndCleaner(Handle snd);
  52.  
  53. void CheckSounds(short whichChan, SndCleanupProc cleaner);
  54.  
  55. // ---------------------------------------------------------------------------
  56.  
  57. // These routines take any sound channel, not just ones created
  58. // with SoundUtils.c
  59. void SndChanStop(SndChannelPtr chan);
  60. Boolean SndChanDone(SndChannelPtr chan);
  61. short SndChanGetAmplitude(SndChannelPtr chan);
  62. void SndChanSetAmplitude(SndChannelPtr chan, short amp);
  63.  
  64. #ifdef __cplusplus
  65. }
  66. #endif
  67.  
  68. #endif // SOUNDUTILS_H_